﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SoftWareLab_Project
{
    public partial class DetailTotalWork : System.Web.UI.Page
    {
        private SertData sert = new SertData();
        private double sum = 0.00;
        protected void Page_Load(object sender, EventArgs e)
        {
            sum = 0.00;
            if (!IsPostBack)
            {
                if (Session["User"]!= null)
                {
                    int i = Convert.ToInt32(Session["DetailNo_id"].ToString());

                    dataGridDetail(i);
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
              
            }
        }
        private void dataGridDetail(int i)
        {
            DataTable dt = sert.GetDataNo(i);

            if (dt != null && dt.Rows.Count > 0)
            {
                lbName.Text = dt.Rows[0]["NAME"].ToString();
                lbLName.Text = dt.Rows[0]["LASTNAME"].ToString();
                lbYear.Text = dt.Rows[0]["YEAR"].ToString();
                lbTerm.Text = dt.Rows[0]["TERM"].ToString();
                lbTech.Text = string.Format("{0:F2}",dt.Rows[0]["TEACHING_P"]);
                lbReserch.Text = string.Format("{0:F2}",dt.Rows[0]["RESEARCH_P"]);
                lbServince.Text = string.Format("{0:F2}",dt.Rows[0]["SERVICES_P"]);
                lbOther.Text = string.Format("{0:F2}",dt.Rows[0]["OTHER_P"]);
                sum = Convert.ToDouble(lbTech.Text) + Convert.ToDouble(lbReserch.Text) +
                      Convert.ToDouble(lbServince.Text) + Convert.ToDouble(lbOther.Text);
                lbSum.Text = string.Format("{0:F2}", sum);

            }
        }

       
    }
}